import { http } from '@/utils/http/axios';

/**
 * @description: 消息列表
 */
export function messagesList(data?) {
  return http.request({
    url: '/messages/search',
    method: 'post',
    data,
  });
}

/**
 * @description: 我的消息
 */
export function messagesInfo(id?) {
  return http.request({
    url: `/messages/${id}`,
    method: 'get',
  });
}

/**
 * @description: 删除我的消息
 */
export function deleteMessage(id?) {
  return http.request({
    url: `/messages/${id}`,
    method: 'DELETE',
  });
}

/**
 * @description: 获取消息未读数
 */
export function messagesUnread() {
  return http.request({
    url: `/messages/unread`,
    method: 'get',
  });
}

/**
 * @description: 设置消息已读
 */
export function setMsgReading(id?) {
  return http.request({
    url: `/message/reading/${id}`,
    method: 'PATCH',
  });
}

/**
 * @description: 设置所有消息已读
 */
export function setAllMsgReading() {
  return http.request({
    url: `/messages/reading`,
    method: 'PATCH',
  });
}
